import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { JqtCpHtUserVO, JqtCpHtUserForm, JqtCpHtUserQuery } from '@/api/bus/jqtCpHtUser/types';
import { JqtCpInfoForm } from '@/api/bus/jqtCpInfo/types';

/**
 * 查询企业互通用户列表
 * @param query
 * @returns {*}
 */

export const listJqtCpHtUser = (query?: JqtCpHtUserQuery): AxiosPromise<JqtCpHtUserVO[]> => {
  return request({
    url: '/bus/jqtCpHtUser/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询企业互通用户详细
 * @param id
 */
export const getJqtCpHtUser = (id: string | number): AxiosPromise<JqtCpHtUserVO> => {
  return request({
    url: '/bus/jqtCpHtUser/' + id,
    method: 'get'
  });
};

/**
 * 新增企业互通用户
 * @param data
 */
export const addJqtCpHtUser = (data: JqtCpHtUserForm) => {
  return request({
    url: '/bus/jqtCpHtUser',
    method: 'post',
    data: data
  });
};

/**
 * 修改企业互通用户
 * @param data
 */
export const updateJqtCpHtUser = (data: JqtCpHtUserForm) => {
  return request({
    url: '/bus/jqtCpHtUser',
    method: 'put',
    data: data
  });
};

/**
 * 删除企业互通用户
 * @param id
 */
export const delJqtCpHtUser = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bus/jqtCpHtUser/' + id,
    method: 'delete'
  });
};

/**
 * 修改客服成员备注
 * @param data
 */
export const editNameRemark = (data: JqtCpHtUserForm) => {
  return request({
    url: '/bus/jqtCpHtUser/editNameRemark',
    method: 'put',
    data: data
  });
};
/**
 * 查询企业互通用户列表
 * @param query
 * @returns {*}
 */

export const getHtUsers = (query?: JqtCpHtUserQuery): AxiosPromise<JqtCpHtUserVO[]> => {
  return request({
    url: '/bus/jqtCpHtUser/getHtUsers',
    method: 'get',
    params: query
  });
};
